class CulturalHeritage::CulturalHeritageYoutube < ActiveRecord::Base
  validates :title, :presence => {:message => "El Titulo es requerido"}
  validates :video_id, :presence => {:message => "El id del video es requerido"}
  belongs_to :obj_user, :class_name => 'User',  :foreign_key => 'user'
  validates_length_of :video_id, :maximum => 11
  validates_length_of :video_id, :minimum => 11
  default_scope where("deleted = 0")

  def image_url
    return 'http://img.youtube.com/vi/'+video_id+'/1.jpg'
  end

  def video_url
    return 'http://www.youtube.com/watch?v='+video_id+''
  end

  def video_description
    return '('+title+') -'+description+''
  end

  def video_url_embed
    return 'http://www.youtube.com/embed/'+video_id+'?wmode=opaque'
  end
end
